
package cn.gov.service.impl;

import java.util.ArrayList;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import cn.geracomium.util.service.abs.AbstractService;
import javax.annotation.Resource;

import cn.gov.dao.IProvinceAndCityDAO;
import cn.gov.service.ICityAndProvinceService;
import com.alibaba.dubbo.config.annotation.Service;

import cn.gov.dao.IServiceStationDAO;
import cn.gov.service.IServiceStationService;
import cn.gov.vo.ServiceStation;

@Service
public class ServiceStationServiceImpl extends AbstractService implements IServiceStationService {

    @Resource
    private IServiceStationDAO dao;

    @Resource
    private IProvinceAndCityDAO PCdao;



    @Override
    public List<ServiceStation> getAllSs() {
        return this.dao.findAllSs();
    }

    @Override
    public ServiceStation getById(int id) {
        // TODO Auto-generated method stub
        return null;
    }
    @Override
    public Map<String ,Object> getSplit(long currentPage,int lineSize,String column,String keyWord) {
        HashMap<String,Object> object = new HashMap<String,Object>();
        object.put("allProvince",this.PCdao.findAllProvince());
        object.put("allSs", this.dao.findSplit(super.paramConverterMap(currentPage,lineSize,null,null)));
        object.put("allRecorders",this.dao.getCount(super.paramConverterMap(currentPage,lineSize,column,keyWord)));
        return object ;
    }
    @Override
    public boolean delete(Integer id){
       return  this.dao.remove(id);
    }
    @Override
    public ServiceStation getById(Long id){
        return this.dao.findById(id);
    }
    @Override
    public boolean doEdit(ServiceStation serviceStation){
        return this.dao.doUpdate(serviceStation);
    }
    @Override
    public boolean doAdd(ServiceStation serviceStation){
        return this.dao.doCreate(serviceStation);
    }
    @Override
    public Map<String,Object> getByPCA(String province,String city,String area){
        HashMap<String,Object> object = new HashMap<>();
        HashMap<String,String> map = new HashMap<>();
        map.put("province",province);
        map.put("city",city);
        map.put("area",area);
        System.err.println(this.dao.findSearchCount(map));
        object.put("allStations",this.dao.findByPCA(map));
        object.put("totalCount",this.dao.findSearchCount(map));
        return  object;
    }




}

